<template>
	<view class="find">
		<view class="find-nav">
			<view class="text-holder" :class="{active:showIndex===index}" v-for="(item,index) in navList" :key="index" @tap='navClick(index)'>
				<text>{{item}}</text>	
			</view>
		</view>
		
		<find-article v-if="showIndex==0"></find-article>
		<find-brand v-else></find-brand>
	</view>
</template>

<script>
	import FindArticle from 'pages/find/find-article'
	import FindBrand from 'pages/find/find-brand'
	export default {
		data() {
			return {
				navList:['精选文章','品牌列表'],
				showIndex:0,
			}
		},
		methods: {
			navClick(index){
				// console.log(index);
				this.showIndex = index;
			}
		},
		components:{
			'find-article':FindArticle,
			'find-brand':FindBrand,
		}
	}
</script>

<style lang="scss" scoped>
.find{
	.find-nav{
		display: flex;
		justify-content: center;
		align-items: center;
		width: 100%;
		height: 88rpx;
		
		background-color: rgb(53, 78, 68);
		
		.text-holder{	
			box-sizing: border-box;
			padding:10rpx 0;
			margin:0 10rpx;
			font-size: 16px;
			border-bottom: 1px solid transparent;
			color: #fff;
		}
		
		.text-holder.active{
			border-bottom: 1px solid #fff;
		}
	}
}
</style>
